package com.bigdata

object Demo8CaseClass {

  def main(args: Array[String]): Unit = {

    // 创建样例类，可以省略new关键字
    val t1: Teacher = Teacher(10, "zs")
    val t2: Teacher = new Teacher(10, "zs")

    println(t1 == t2)

    println(t1)

    println(t1.id)
    println(t1.name)

    println(t1.equals(t2))

    t1.name = "lisi"
    println(t1)


  }

}

// case 修饰的类，是样例类
case class Teacher(id: Int, var name: String)
//class Teacher(id: Int, name: String) {
//  override def equals(obj: Any): Boolean = {
//    true
//  }
//}
